<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改班级')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-class-edit" th:object="${adminClass}">
            <input name="classId" th:field="*{classId}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">班级名称：</label>
                <div class="col-sm-8">
                    <input name="className" th:field="*{className}" class="form-control" type="text">
                </div>
            </div>
            
            <div class="form-group">
            <label class="col-sm-3 control-label">教师：</label>
                 <div class="col-sm-8">
                     <label th:each="item : ${teacherList}" class="check-box">
                       	<input name="teacherId" type="checkbox" th:value="${item.userId}" th:text="${item.userName}" th:attr ="checked=${teacherIdList.contains(item.userId)?true:false}">
                     </label>
                 </div>
            </div>
            
            <div class="form-group">    
                <label class="col-sm-3 control-label">状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_able_status')}">
                        <input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
                        <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "system/class";
        $("#form-class-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
            	var data = $("#form-class-edit").serializeArray();
            	
            	var teacherIds = $.form.selectCheckeds("teacherId");
            	data.push({"name": "teacherIds", "value": teacherIds});
                $.operate.save(prefix + "/edit", data);
            }
        }
    </script>
</body>
</html>